
<%@ page contentType="text/html;charset=UTF-8" %>
<%
  String msg = (String) request.getAttribute("msg");
%>
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8"/>
  <title>码农小站--用户登录</title>
  <link rel="icon" href="./favicon/favicon.ico" type="image/x-icon">
  <link href="https://cdn.bootcdn.net/ajax/libs/bootstrap/5.3.2/css/bootstrap.min.css" rel="stylesheet">
  <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/bootstrap-icons/1.11.1/font/bootstrap-icons.min.css">
  <script src="js/bootstrap.bundle.min.js"></script>
  <style>
    body { background-color: #f8f9fa; }
    .login-card { max-width: 400px; margin: 80px auto; }
  </style>
</head>
<body>
<div class="card shadow login-card">
  <div class="card-body">
    <h4 class="card-title text-center mb-4">博客登录</h4>
    <% if (msg != null) { %>
    <div class="alert alert-danger text-center"><%= msg %></div>
    <% } %>
    <form action="<%=request.getContextPath()%>/loginServlet?method=login" method="post">
      <div class="mb-3">
        <label class="form-label">用户名</label>
        <input type="text" class="form-control" name="username" required>
      </div>
      <div class="mb-3">
        <label class="form-label">密码</label>
        <input type="password" class="form-control" name="password" required>
      </div>
      <button type="submit" class="btn btn-primary w-100">登录</button>
    </form>
    <p class="text-center mt-3">
      没有账号？<a href="<%=request.getContextPath()%>/register.jsp">立即注册</a>
    </p>
  </div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>